package com.mall.shopping.converter;

import com.mall.shopping.dal.entitys.Item;
import com.mall.shopping.dto.ShoppingGoodsVo;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;

import java.util.List;

/**
 * @author jiaolei
 */
@Mapper(componentModel = "spring")
public interface ItemToShoppingGoodsDtoConverter {
    ShoppingGoodsVo itemToShoppingGoodsDto(Item item);
    @Mappings({
            @Mapping(source = "id",target = "productId"),
            @Mapping(source = "price",target = "salePrice"),
            @Mapping(source = "title",target = "productName"),
            @Mapping(source = "sellPoint",target = "subTitle"),
            @Mapping(source = "imageBig",target = "picUrl")
    })
    ShoppingGoodsVo.ShoppingGoodsDto itemToDto(Item items);

    List<ShoppingGoodsVo.ShoppingGoodsDto> itemToShoppingGoodsDto(List<Item> items);

}
/**
 * productId : 100040607
 * salePrice : 2999
 * productName : 坚果 3
 * subTitle : 坚果 3 意外碎屏保修服务（碎屏险）
 * picUrl : https://resource.smartisan.com/resource/13e91511f6ba3227ca5378fd2e93c54 b.png
 */